import request from "../request.js"

const base_url = 'https://api.wxls.pro/boya' || 'https://boyastudy.wxls.pro'

let header = {
	"content-type": "application/json"
}

/**
 * 埋点
 */
export const set = async (par,wxlsToken) => {
	let header = { "content-type":"application/json" }
	if(wxlsToken && wxlsToken.wxlsToken){
		header['Authorization'] = `bearer ${wxlsToken.wxlsToken}`
	}
	let { data } = await request({
		url: `${base_url}/api/integral/setPoint`,
		header,
		method: 'GET',
		data: par
	});
	if (!data.success) {
		uni.showToast({
			title: data.message || '获取失败',
			duration: 2000,
			icon: 'none'
		});
		return Promise.reject(new Error(data.message || '获取失败'))
	}
	return data.data
}